package com.fourth.shopping.controller;


import com.fourth.shopping.entity.Address;
import com.fourth.shopping.service.AddressService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


@RestController
@RequestMapping("/address")

public class AddressController {

    @Resource
    AddressService addressService;

    @GetMapping("/getAddress.do")
    public List<Address> getAddress(String userId) {

        List<Address> address = addressService.getAddress(userId);

        System.out.println("收货地址管理："+address);
        return address;
    }


    @RequestMapping("/getCurrentOrderAddresses.do")
    public List<Address> getCurrentOrderAddresses(@RequestParam("orderNo")String orderNo){
        List<Address> addressList = addressService.getCurrentOrderAddresses(orderNo);
        return addressList;
    }
}
